package
{
import assets.avatar.ac.AC10000Asset;

import com.waitingsnow.core.base.BaseSprite;
import com.waitingsnow.core.debug.LogOutput;
import com.waitingsnow.core.debug.Logger;
import com.waitingsnow.core.display.player.BmpDataPlayer;
import com.waitingsnow.core.service.CookieService;
import com.waitingsnow.core.util.display.BmpDataUtil;
import com.waitingsnow.core.util.display.ObjectPoolUtil;

import flash.system.Security;
import flash.utils.setTimeout;

/**
 * 
 * @author waitingsnow
 * $Id: MyComb.as 2 2012-05-17 10:10:03Z cgslendy@gmail.com $
 */
[SWF(frameRate="20", backgroundColor="#000000")]
public class MyComb extends BaseSprite
{
	//==========================================================================
	//  Constructor
	//==========================================================================
	/**
	 * Constructs a new <code>MyComb</code> instance.
	 * 
	 */
	public function MyComb()
	{
		super();
	}
	
	//==========================================================================
	//  Methods
	//==========================================================================
	override protected function initSystemSet():void
	{
		super.initSystemSet();
		Security.allowDomain("*");
		Security.allowInsecureDomain("*");
		if (CONFIG::debugging)
		{
			var output:LogOutput = new LogOutput();
			addChild(output);
			removeChild(output);
		}
	}
	
	override protected function initDisplay():void
	{
		Security.allowDomain("*");
		Security.allowInsecureDomain("*");
		super.initDisplay();
		super.initDebugInfo(CONFIG::debugging);
		
//		testLog();
//		testBitmap();
//		testPool();
//		testCookie();
		testToolTip();
	}
	
	private function testToolTip():void
	{
		var str:String;
		str += "dd";
		Logger.debug("dd", str);
	}
	
	private function testCookie():void
	{
		var cookie:CookieService = new CookieService("testCookie");
		cookie.expires = 4;
		cookie.setProps("name12", "cgslendy11ff2");
		Logger.debug("cookie get name: " + cookie.getProps("name12"));
		cookie.delProps("name12");
		Logger.logObject("so: ", cookie.getObject());
	}
	
	private function testLog():void
	{
		Logger.debug("this is debug info");
		Logger.info("this is info info");
		Logger.warn("this is warn info");
		Logger.error("this is error info");
	}
	
	private function testBitmap():void
	{
		var bmp:BmpDataPlayer = new BmpDataPlayer();
		bmp.repeatCount = 0;
		bmp.bmpDataArr = BmpDataUtil.getBmpDataArr(new AC10000Asset());
		bmp.play();
		addChild(bmp);
	}
	
	private function testPool():void
	{
		var obj1:Object = {1:1, 2:2, 3:3}; 
		ObjectPoolUtil.collectObject(obj1);
		
		var obj:Object = ObjectPoolUtil.getObject(Object);
		Logger.logObject("obj: ", obj);
		ObjectPoolUtil.disposeObject(Object);
		obj = ObjectPoolUtil.getObject(Object);
		Logger.logObject("obj: ", obj);
	}
}
}